/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * IndexFrame.java
 *
 * Created on 10/07/2010, 20:09:35
 */

package net.jcdev.coolrss.view;

import com.explodingpixels.macwidgets.BottomBar;
import com.explodingpixels.macwidgets.BottomBarSize;
import com.explodingpixels.macwidgets.MacIcons;
import com.explodingpixels.macwidgets.MacUtils;
import com.explodingpixels.macwidgets.MacWidgetFactory;
import com.explodingpixels.macwidgets.SourceList;
import com.explodingpixels.macwidgets.SourceListCategory;
import com.explodingpixels.macwidgets.SourceListItem;
import com.explodingpixels.macwidgets.SourceListModel;
import com.explodingpixels.macwidgets.UnifiedToolBar;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.border.MatteBorder;
import thinlet.swing.app.AppFrame;
import thinlet.swing.app.TipManager;
import thinlet.swing.border.LineBorder;
import thinlet.swing.container.MenuList;
import thinlet.swing.container.SplitPane;
import thinlet.swing.container.ToolFooter;

/**
 *
 * @author carlos
 */
public class IndexFrame extends AppFrame {

    private SplitPane splitPane;
    private MenuList menuList;
    private JPanel leftPanel;
    private ToolFooter toolPanel;
    private JPanel content;

    private MenuList.Item documentItem = null;
    private MenuList.Item webItem = null;

    /** Creates new form BeanForm */
    public IndexFrame() {
        initComponents();

        //getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
        

        documentItem = new MenuList.Item("Documentos");
        documentItem.setCount("10");
        documentItem.setToolTipText("Visualizar resultados do tipo documento");
        TipManager.register(documentItem);

        webItem = new MenuList.Item("Páginas");
        webItem.setCount("13");
        webItem.setToolTipText("Visualizar resultados do tipo páginas da web");
        TipManager.register(webItem);

        leftPanel = new JPanel(new BorderLayout());
        leftPanel.setBorder(new LineBorder(new Color(0xaaaaaa), 0, 0, 0, 1));

        menuList = new MenuList();


        menuList.addGroup("Tags");

        menuList.add(documentItem);
        menuList.add(webItem);

        SourceListModel model = new SourceListModel();
        SourceListCategory category = new SourceListCategory("Category");
        model.addCategory(category);
        model.addItemToCategory(new SourceListItem("Item"), category);
        SourceListCategory musicCategory = new SourceListCategory("Music");
        model.addCategory(musicCategory);
        SourceListItem gearItem = new SourceListItem("Settings", MacIcons.GEAR);
        gearItem.setCounterValue(10);
        model.addItemToCategory(gearItem, musicCategory);
        model.addItemToCategory(new SourceListItem("Adicionar", MacIcons.PLUS), musicCategory);
        SourceList sourceList = new SourceList(model);

        sourceList.getComponent().setToolTipText("Hello World");
        TipManager.register(sourceList.getComponent());
        leftPanel.add(sourceList.getComponent(), BorderLayout.CENTER);

        toolPanel = new ToolFooter();
        toolPanel.add(Box.createHorizontalGlue());
        toolPanel.setBorder(new LineBorder(new Color(0xaaaaaa), 1, 0, 0, 0));
        leftPanel.add(toolPanel, BorderLayout.SOUTH);

        content = new JPanel(new BorderLayout());
        //content.add(new FeedPanel(), BorderLayout.CENTER);
        //content.add(new JLabel("<html><b>Hello World</b></html>"), BorderLayout.NORTH);
        //content.add(new JButton("Hello World"), BorderLayout.SOUTH);

        splitPane = new SplitPane(leftPanel, content, JSplitPane.HORIZONTAL_SPLIT);

        toolPanel.add(splitPane.getKnob());

        this.add(splitPane, BorderLayout.CENTER);

        content.setBackground(new Color(216, 216, 216));

        MacUtils.makeWindowLeopardStyle(this.getRootPane());

        UnifiedToolBar toolBar = new UnifiedToolBar();
        JButton button = new JButton("My Button");
        button.putClientProperty("JButton.buttonType", "textured");
        //button.setContentAreaFilled(false);
        button.setBorderPainted(false);
        toolBar.addComponentToLeft(button);
        toolBar.addComponentToRight(new JTextField());
        this.add(toolBar.getComponent(), BorderLayout.NORTH);

        BottomBar bottomBar = new BottomBar(BottomBarSize.LARGE);
        bottomBar.addComponentToLeft(new JButton(MacIcons.PLUS));
        bottomBar.addComponentToCenter(MacWidgetFactory.createEmphasizedLabel("My Label"));

        this.add(bottomBar.getComponent(), BorderLayout.SOUTH);
        
        //this.add(bottomBar, BorderLayout.SOUTH);

        //this.setBorder(new LineBorder(new Color(0xaaaaaa), 1, 0, 1, 0));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);
    }// </editor-fold>//GEN-END:initComponents

    @Override
    protected void init() {
        
    }

    @Override
    protected boolean close() {
        return true;
    }

    /**
     * Exibe a janela principal da aplicação.
     * @param x
     * @param y
     */
    public final void showIndexFrame(final int x, final int y) {
        super.showFrame(x, y);
    }

    @Override
    protected void setIconImage(String path) {
        super.setIconImage(path);
    }

    @Override
    protected void showAbout() {
        AboutBox aboutBox = new AboutBox();
        aboutBox.setLocationRelativeTo(null);
        aboutBox.setVisible(true);
    }

    @Override
    protected void showPreferences() {
        super.showPreferences();
    }




    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    // End of variables declaration//GEN-END:variables

}
